package problems.solved;

import java.math.BigInteger;

import problems.Problem;

import utils.Utils;

public class Problem56 extends Problem<Integer> {
	public static void main(String[] args) {
		Problem56 problem56 = new Problem56();
		problem56.runTimed();
		problem56.printResult();
	}
	
	@Override
	public void run() {
		int max = 1;
		for (int a = 1; a < 100; a++) {
			for (int b = 1; b < 100; b++) {
				int sum = Utils.sumForNumbers(BigInteger.valueOf(a).pow(b).toString());
				if (sum > max) {
					max = sum;
				}
			}
		}
		setResult(max); // 972
	}
}
